package sdk.weinxin.beans.massmessage;

import sdk.weinxin.beans.media.Text;
import sdk.weinxin.beans.massmessage.preview.Preview;

import sdk.weinxin.beans.massmessage.preview.TextPreview;

public class MassTextMessage extends MassMessage {

    private Text text;

    public MassTextMessage() {
        super();
        this.setMsgType("text");
    }

    public MassTextMessage(String content) {
        super();
        text = new Text(content);
        this.setMsgType("text");
    }

    public Text getText() {
        return text;
    }

    public void setText(Text text) {
        this.text = text;
    }

    @Override
    public Preview convert() {
        Preview preview = new TextPreview(text.getContent());
        if (this.getToUser() != null && this.getToUser().size() > 0) {
            preview.setToUser(this.getToUser().iterator().next());
        }
        return preview;
    }

}
